package com.retailshop.shopuser.UserTask;

import com.retailshop.shopuser.common.ParameterUtil;
import com.retailshop.shopuser.service.UserOwnerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping(value = "/Owner")
public class OwnerAuto {

    @Autowired
    UserOwnerService userOwnerService;

    @ResponseBody
    @RequestMapping("/settlementRealpay")
    public boolean settlementRealpay(HttpServletRequest request) {
        return userOwnerService.settlementRealpay();
    }

    @ResponseBody
    @RequestMapping("/lowerOwner")
    public boolean lowerOwner(HttpServletRequest request) {
        return userOwnerService.lowerOwner();
    }

    @ResponseBody
    @RequestMapping("/clearUserShopShare")
    public boolean clearUserShopShare(HttpServletRequest request) {
        return userOwnerService.clearUserShopShare();
    }

    @ResponseBody
    @RequestMapping("/checkStar")
    public boolean checkStar(HttpServletRequest request) {
        return userOwnerService.checkStar();
    }

    @ResponseBody
    @RequestMapping("/checkActivation")
    public boolean checkActivation(HttpServletRequest request) {
        return userOwnerService.checkActivation();
    }

    @ResponseBody
    @RequestMapping("/checkOwner")
    public boolean checkOwner(HttpServletRequest request) {
        return userOwnerService.checkOwner();
    }

    @ResponseBody
    @RequestMapping("/checkOwnerInternship")
    public boolean checkOwnerInternship(HttpServletRequest request) {
        int id = ParameterUtil.getIntParameter(request.getParameter("id"));
        if(id>0) {
            return userOwnerService.checkOwnerInternship(id);
        }
        return true;
    }

    @ResponseBody
    @RequestMapping("/checkOwnerInternshipAll")
    public boolean checkOwnerInternshipAll(HttpServletRequest request) {
        return userOwnerService.checkOwnerInternshipAll();
    }

}
